import React, { Component } from 'react'

import './index.scss'
export default class TableBody extends Component {
    onStatusClick(cid,index){
        this.props.onStatusClick(cid,index)
    }
    render() {
        const {sliderData} = this.props;
        return (
            <tbody>
                {
                    sliderData.map((item,index)=>{
                        return(
                            <tr key={index}>
                                <td>{item.cid}</td>
                                <td>
                                    <a href={item.qqQunLink} target="_blank"  rel="noopener noreferrer">
                                        <img 
                                            src={`http://qexgb3yqx.hn-bkt.clouddn.com/${item.posterKey}`}
                                            alt={item.title}
                                        ></img>
                                    </a>
                                </td>
                                
                                <td className="course-name">
                                    <a href={item.qqQunLink} target="_blank" rel="noopener noreferrer">{item.title}</a>
                                </td>
                               
                                <td>
                                    <button className={['btn',item.status ? 'btn-danger':'btn-success'].join(' ')}
                                    onClick={this.onStatusClick.bind(this,item.cid,index)}>
                                    {item.status === 0 ? '上架' : '下架'}
                                       
                                    </button>
                                </td>
                            </tr>
                        )
                    })
                }
            </tbody>
        )
    }
}
